<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('article', function (Blueprint $table) {
            // 设置存储引擎 
            $table -> engine = 'InnoDB';
            // 设置主键 
            $table -> increments('id') -> comment('主键');
            // 设置标题
            $table -> string('title') -> comment('标题');
            // 设置内容
            $table -> text('content') -> comment('内容');
            // 设置关键字
            $table -> string('keyword') -> comment('关键字');
            // 封面图片路径
            $table -> string('path') -> comment('封面图片路径');
            // 设置作者id
            $table -> integer('u_id')  -> comment('用户id');
            // 开启时间戳
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('article');
    }
}
